package com.itheima.mp.domain.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;

@Getter
public enum UserStatus {

    NORMAL(1, "正常"),
    FROZEN(2, "冻结");

    @EnumValue  // 该注解会将枚举值value存储到数据库中
    private final int value;

    @JsonValue  //  该注解会将枚举值转换为json字符串，前端会自动将json字符串转换为对应的枚举值描述，也就是正常或者冻结
    private final String desc;

    UserStatus(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }
}
